﻿/*
* @autor: hectorea
* @date: 12/07/2012
* @programming interview 9
*/

namespace ReverseANumber
{
    internal static class IntExtension
    {
        /// <summary>
        /// Reverse an integer value
        /// </summary>
        /// <param name="number">Integer value</param>
        /// <returns></returns>
        public static int Reverse(this int number)
        {
            int quotient = number;
            int remainder = 0;
            int result = 0;

            do
            {
                remainder = quotient % 10;
                quotient /= 10;

                result = (result * 10) + remainder;

            } while (quotient > 0);

            return result;
        }
    }
}
